﻿using Generic.Domain.Shared.Base;
using Microsoft.Extensions.Localization;
using Volo.Abp.Application.Services;

namespace Generic.App.Application
{
    public partial class BaseApplicationService<T> : ApplicationService
        where T : CustomAggregateRoot<string>
    {
        protected void SetInsertBy<TM>(TM obj, string? operateUser) where TM : CustomAggregateRoot<string>
        {
            var operateTime = DateTime.Now;
            obj.CreatedBy = operateUser;
            obj.CreatedTime = operateTime;
            obj.LastModifiedBy = operateUser;
            obj.LastModifiedTime = operateTime;
        }

        protected void SetUpdateBy<TM>(TM obj, string operateUser) where TM : CustomAggregateRoot<string>
        {
            var operateTime = DateTime.Now;
            obj.LastModifiedBy = operateUser;
            obj.LastModifiedTime = operateTime;
        }
    }
}
